package org.huzhp.gateway.filter.balance;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * @Description: java类作用描述
 * @Author: huzp
 * @CreateDate: 2020/4/16 14:15
 * @Version: 1.0
 */
@Configuration
public class LoadBalanceClientConfiguration {

    @Bean
    public GatewaySpringClientFactory gatewaySpringClientFactory() {
        GatewaySpringClientFactory springClientFactory = new GatewaySpringClientFactory();
        return springClientFactory;
    }

    @Bean
    public GatewayLoadBalanceClient gatewayLoadBalanceClient() {
        return new GatewayLoadBalanceClient(gatewaySpringClientFactory());
    }

//    @Bean
//    @ConditionalOnMissingBean
//    public IRule ribbonRule() {
//        ZoneAvoidanceRule rule = new ZoneAvoidanceRule();
//        return rule;
//    }
//
//    @Bean
//    @ConditionalOnMissingBean
//    public ServerListFilter<Server> ribbonServerListFilter() {
//        ZonePreferenceServerListFilter filter = new ZonePreferenceServerListFilter();
//        return filter;
//    }
//
//    @Bean
//    @ConditionalOnMissingBean
//    public ServerListUpdater ribbonServerListUpdater() {
//        return new PollingServerListUpdater();
//    }
//
//    @Bean
//    @ConditionalOnMissingBean
//    public RibbonLoadBalancerContext ribbonLoadBalancerContext(ILoadBalancer loadBalancer) {
//        return new RibbonLoadBalancerContext(loadBalancer);
//    }
//
//    @Bean
//    @ConditionalOnMissingBean
//    public RetryHandler retryHandler() {
//        return new DefaultLoadBalancerRetryHandler();
//    }
//
//    @Bean
//    @ConditionalOnMissingBean
//    public IPing ribbonPing() {
//        return new DummyPing();
//    }

//    @Bean
//    @ConditionalOnMissingBean
//    public ILoadBalancer ribbonLoadBalancer() {
//        ZoneAwareLoadBalancer zoneAwareLoadBalancer = new ZoneAwareLoadBalancer();
//        zoneAwareLoadBalancer.addServers();
//        return zoneAwareLoadBalancer;
//    }

}
